import type { ElementHiderRuleConfig } from '../../../types/constants'
import { PageHandler } from '../../../lib/page_handler'
import { IconfontPageType } from '../../../lib/page_handler/platform/iconfont/types'
import { ElementSelectorPosition, ElementSelectorType } from '../../../types/constants'
import { ELEMENT_IDENTIFIER_CONFIG } from '../../service/element_identifier/types'

export const ICONFONT_WEB_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.default.announcement.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#root .top-tip',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        IconfontPageType.Index,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as IconfontPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.oneClickGeneration.id]: {
    hide: false,
    selectorType: ElementSelectorType.Complex,
    selector: '#root #magix_vf_main .search-wrap > .section:has(.section-content > .ai-icon-list)',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        IconfontPageType.Index,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as IconfontPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.newArrivals.id]: {
    hide: false,
    selectorType: ElementSelectorType.Complex,
    selector: '#root #magix_vf_main .search-wrap > .section-ai-tools',
    nameZh: '工具上新',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        IconfontPageType.Index,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as IconfontPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.latestMessage.id]: {
    hide: false,
    selectorType: ElementSelectorType.Complex,
    selector: '#root #magix_vf_main .search-wrap > .section:has(.section-content > .news-list)',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        IconfontPageType.Index,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as IconfontPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.platformGuide.id]: {
    hide: false,
    selectorType: ElementSelectorType.Complex,
    selector: '#root #magix_vf_main .search-wrap > .section-tabs',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        IconfontPageType.Index,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as IconfontPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.featuredContent.id]: {
    hide: false,
    selectorType: ElementSelectorType.Complex,
    selector: '#root #magix_vf_main .search-wrap > .section-masonry',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        IconfontPageType.Index,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as IconfontPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.feedback.id]: {
    hide: false,
    selectorType: ElementSelectorType.Class,
    selector: '.iconfont-feedback-btn',
    position: ElementSelectorPosition.MiddleRight,
    enable: () => {
      const supportPages = [
        IconfontPageType.Index,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as IconfontPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.hoverToolBar.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#root .block-sidebar',
    position: ElementSelectorPosition.MiddleRight,
    enable: () => {
      const supportPages = [
        IconfontPageType.Index,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as IconfontPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.footer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#root .footer',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        IconfontPageType.Index,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as IconfontPageType)
    },
  },
}
